// 噪点滤镜
const noise = function (pixels, amount) {
    var data = pixels.data;
    var er = 10; // extra red
    var eg = 10; // extra green
    var eb = 10; // extra blue
    for (let i = 0, n = data.length; i < n; i += 4) {
        let randColor1 = 0.6 + Math.random() * 0.5;
        let randColor2 = 0.6 + Math.random() * 0.5;
        let randColor3 = 0.6 + Math.random() * 0.5;
        data[i] = data[i] * randColor1 + er;
        data[i+1] = data[i+1] * randColor2 + eg;
        data[i+2] = data[i+2] * randColor3 + eb;
    }
    return pixels;
}

export default noise
